// 获取操作日（当天）的年月日
export function getCurrentDay(){
	const today = new Date();
	const year = String(today.getFullYear());
	const month = String(today.getMonth() + 1).padStart(2, '0');
	const day = String(today.getDate()).padStart(2, '0');
	const formattedDate = `${year}-${month}-${day}`;
	return formattedDate
}
// 获取当月1号
export function getfirstDayOfMonth(){
	const today = new Date();
	const year = String(today.getFullYear());
	const month = String(today.getMonth() + 1).padStart(2, '0');
	const firstDayOfMonth = `${year}-${month}-01`;
	return firstDayOfMonth
}

/* 
	method:比较两个月份大小
	entryTime:入职时间 
	getfirstDayOfMonth(): 操作月
	return：如果入职日期<=操作月1日，返回操作月1日
				  如果入职日期>操作月1日，返回入职日期，。
*/
export function compareTwoDate(entryTime){
	const operationMonth = getfirstDayOfMonth()
	const date1 = new Date(entryTime);
	const date2 = new Date(operationMonth);
	let compareDate 
	if (date1.getTime() <= date2.getTime()) {
		compareDate = operationMonth
	} else {
		compareDate = entryTime
	} 
	return compareDate
}

